<template>
  <div class="chat-record-item-container">
    <div class="ask-wrap">
      <el-tag type="danger" class="font-bold font-16"> {{ detail.askContent }}</el-tag>
      <div class="patient-info">
        <div class="patient-wrap">
          <el-avatar shape="circle" size="small" :src="detail.patient.avatar"/>
          <span class="ml10">{{ detail.patient.nickname }}</span>
        </div>
        <div class="dt">
          <el-icon>
            <ele-Clock/>
          </el-icon>
          {{ detail.createdAt }}
        </div>
      </div>
    </div>
    <div class="answer-wrap">
      {{ detail.answerContent }}
    </div>
  </div>
</template>

<script lang="ts">
import {reactive, toRefs, defineComponent} from 'vue';

export default defineComponent({
  name: 'chatRecordItem',
  props: {
    detail: {
      type: Object,
      default: () => {
        return {
          id: 0,
          openId: null,
          patient: {},
          askContent: null,
          answerContent: null,
          createdAt: '',
        }
      }
    }
  },
  setup(prop, {emit}) {
    const state = reactive({});
    return {
      ...toRefs(state),
    };
  },
});
</script>
<style scoped lang="scss">
.chat-record-item-container {
  padding: 20px 15px;
  margin-bottom: 15px;
  border: 1px solid #efefef;
  border-radius: 6px;
  cursor: pointer;

  &:hover {
    box-shadow: 0 6px 5px 0 #EFEFEF;
  }

  .ask-wrap {
    display: flex;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    margin-bottom: 20px;

    .patient-info {
      display: flex;
      align-items: center;

      .patient-wrap {
        display: flex;
        align-items: center;
        margin-right: 20px;
        color: var(--el-color-primary);
      }

      .dt {
        display: flex;
        align-items: center;

        .el-icon {
          margin-right: 6px;
        }
      }
    }

  }

  .answer-wrap {
    border: 1px solid var(--el-color-info-light-8);
    border-radius: 6px;
    padding: 5px 9px;
    color: var(--el-text-color-primary);
  }
}
</style>
